package org.lboot.ufos.api;

import cn.hutool.core.util.StrUtil;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.S3ObjectSummary;

import java.util.List;

/**
 * @author kindear
 * 版本管理接口
 */
public interface VersionApi extends ObjectApi{
    default List<S3ObjectSummary> listObjectVersions(String bucketName, String objectName){
        // 构建临时前缀
        String objPrefix = StrUtil.subBefore(objectName,"@",true);
        // 复制临时
        ObjectListing objectListing = getObjectsByPrefix(bucketName, objPrefix);
        return objectListing.getObjectSummaries();
    }
    void enableVersion(String bucketName);
}
